import { defineStore } from 'pinia'
import { ref, computed } from 'vue'

// 暴露函数名							// 仓库的唯一标识（名字）
export const useCounterStore = defineStore(
  'counter',
  () => {
    const token = ref('')
    const setToken = (newToken) => {
      token.value = newToken
    }
    const removeToken = () => {
      token.value = ''
    }

    // 返回属性、方法
    return {
      token,
      setToken,
      removeToken
    }
  },
  {
    persist: {
      key: 'token'
    }
  }
)
